package com.vsu.bookstore.mvc.ui.widgets;

import com.vaadin.terminal.ThemeResource;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.NativeButton;

@SuppressWarnings("serial")
public class CartButtons extends HorizontalLayout
{
  private final NativeButton addToCart = new NativeButton("");

  private final NativeButton removeFromCart = new NativeButton("");

  public CartButtons()
  {
    super();
    setMargin(false);
    setSpacing(false);
    setSizeUndefined();
    addToCart.addStyleName("borderless");
    addToCart.setIcon(new ThemeResource("icons/cart_add.png"));
    removeFromCart.addStyleName("borderless");
    removeFromCart.setIcon(new ThemeResource("icons/cart_delete.png"));
    addComponent(addToCart);
    addComponent(removeFromCart);
    setComponentAlignment(addToCart, Alignment.BOTTOM_CENTER);
    setComponentAlignment(removeFromCart, Alignment.BOTTOM_CENTER);
  }

  void addAddListener(final Button.ClickListener listener)
  {
    addToCart.addListener(listener);
  }

  void addRemoveListener(final Button.ClickListener listener)
  {
    removeFromCart.addListener(listener);
  }
}
